package com.PAT.practice01;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2021/12/22/14:14
 * @Description:
 * @Target:
 */
public class 在霍格沃茨找零钱 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s1 = in.next();
        String s2 = in.next();

        String[] split1 = s1.split("\\.");
        String[] split2 = s2.split("\\.");


        int[] ints1 = new int[3];
        int[] ints2 = new int[3];
        int[] ints3 = new int[3];
        int ints1Sum = 0;
        int ints2Sum = 0;
        int ints3Sum = 0;


        for (int i = 0; i < ints1.length; i++) {
            ints1[i] = Integer.valueOf(split1[i]);
        }

        for (int i = 0; i < ints2.length; i++) {
            ints2[i] = Integer.valueOf(split2[i]);
        }

        ints1Sum = ints1[0]*17*29+ints1[1]*29+ints1[2];
        ints2Sum = ints2[0]*17*29+ints2[1]*29+ints2[2];
        ints3Sum = ints2Sum-ints1Sum;

        System.out.println(ints1Sum+" "+ints2Sum+" "+ints3Sum);

        int v1 = 0;
        int v2 = 0;
        int v3 = 0;
        if (ints3Sum<0){
            ints3Sum = -ints3Sum;
            v3 = ints3Sum%29;
            v2 = ((ints3Sum-v3)/29)%17;
            v1 = (ints3Sum-v3-v2*29)/(17*29);
            System.out.println("-" + v1 + "." + v2 + "." + v3);
        }else {
            v3 = ints3Sum%29;
            v2 = ((ints3Sum-v3)/29)%17;
            v1 = (ints3Sum-v3-v2*29)/(17*29);
            System.out.println(v1 + "." + v2 + "." + v3);
        }


    }

}
